home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Event / c / MRelWindow < prev    next >
Text File  |  1995-07-08  |  2KB  |  58 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Event.MRelWindow.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (16 Mar 1992)
  14.     Purpose: Extension to Event.c to allow routing of specific message types
  15.              to different windows' message handlers.
  16. */
  17.  
  18. #include "EMsgDefs.h"
  19.  
  20.  
  21.  
  22. extern int EventMsg_ReleaseWindow(window_handle window)
  23. {
  24.   eventmsg_claimrecord *ptr, *nextmess;
  25.   eventmsg_windowrecord *wptr, *next;
  26.   int result = 0;
  27.  
  28.   ptr = (eventmsg_claimrecord *) eventmsg__claimanchor.next;
  29.  
  30.   while (ptr != NULL)                           /* Search all message claims */
  31.   {
  32.     wptr = (eventmsg_windowrecord *) ptr->windowlist.next;
  33.     while (wptr != NULL)                        /* Search all window claims  */
  34.     {
  35.       next = (eventmsg_windowrecord *) wptr->header.next;
  36.       if (wptr->window == window)          /* found a claim for this window  */
  37.       {
  38.         LinkList_Unlink(&(ptr->windowlist), &(wptr->header));
  39.         free(wptr);
  40.         result += 1;                       /* Count of window claims removed */
  41.       }
  42.       wptr = next;
  43.     }
  44.  
  45.     nextmess = (eventmsg_claimrecord *) ptr->header.next;
  46.     if (ptr->windowlist.next == NULL)                 /* m-list is now empty */
  47.     {
  48.       LinkList_Unlink(&eventmsg__claimanchor, &(ptr->header));
  49.                                                       /* remove message type */
  50.       free(ptr);                                      /* free memory up      */
  51.     }
  52.  
  53.     ptr = nextmess;
  54.   }
  55.  
  56.   return(result);
  57. }
  58.